package com.utility;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

import com.utility.HTTPConnection;

public class CSVUtility{
	
	public static void main(String[] args) throws Exception{
		URL url = new URL("http://mail.yahoo.com");

		HttpURLConnection con = (HttpURLConnection) url.openConnection();


		con.setRequestProperty( "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" );


		BufferedReader rd; 
		rd = new BufferedReader(new InputStreamReader(con.getInputStream()));
		String line="";
		String content="";
		 while ((line = rd.readLine()) != null) {
		            content += line;
		         }
		         rd.close();
	         System.out.println("content : "+content);  
	}

	public static String getCVSQuote(String stockName, String format) throws IOException {
		final String url = "http://in.finance.yahoo.com/d/quotes.csv?s="+stockName+"&f="+format+"&e=.csv"; 
		return HTTPConnection.connect(url, "ptproxy.persistent.co.in", "8080", "nileshkumar_patel", "nnccPP!@#");
		
	}
	
	
}